<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta charset="UTF-8">
<meta name="viewport"
	content="width=device-width,initial-scale=1,user-scalable=0">
<title>企业商户开户</title>
<%@ include file="/pages/wx/baseHead.jsp"%>
<style type="text/css">
	.clearBorderTop{
	}
	.clearBorderTop:BEFORE {
		border-top: 0px solid red;
	}
</style>



<script type="text/javascript">
	
	var checkRet = null;
	
	function checkPhone()
	{
		var phone = $("#contactPhone").val();
		if(isNull(phone)) return;
		$.ajax({
			url:'checkRepeat.do',
			async:true,
			data:
			{
				phone:phone,
				v:new Date().getTime()
			},
			success:function(ret){
				checkRet = ret;
				check();
			},
			fail:function(){
				
			}
		});
	}
	
	function check()
	{
		if(null == checkRet)
		{
			return flase;
		}
		if(checkRet.code == '1')
		{
			$("#repeatDiv").text(checkRet.msg);
			return false;
		}else if(checkRet.code == '2')
		{
			confirm('提示',checkRet.msg,function(){
				to('bizMerchantOpen.do?mercNo='+checkRet.obj);
			});
			return false;
		}else
		{
			$("#repeatDiv").text("");
			return true;
		}
	}
	
	function syncCert()
	{
		var companyCerttype = $("input[name='companyCerttype']:checked").val();
		if(!isNull(companyCerttype))
		{
			$("#companyCertNoDiv")[0].style.display =  '';
		}else
		{
			$("#companyCertNoDiv")[0].style.display =  'none';
		}
	}
	
	function getLocation()
	{
		getLocationH5(function(data){
			var proText  = data.province;
			var cityText = data.city;
			setProAndCity(proText,cityText);
			$("#address").val(data.list[0]);
			
			//转换坐标
			$.ajax({
				url:basePath+'/api/trans.do',
				data:{
					lat:data.lat,
					lng:data.lng
				},
				success:function(data){
					var lat = data.result[0].y;
					var lng = data.result[0].x;
					$("#lat").val(lat);
					$("#lng").val(lng);
				},
				error:function(){
					alert('error');
				}
			});
		});
	}
	
</script>
</head>
<body ontouchstart>
	<form action="${urlBasePath}weixin/user/bizMerchantOpen.do" id="theform" name="theform" method="post" onsubmit="return check();">
	<div class="bd" style="height: 100%;width: 100%; position: fixed;">
	    <div class="weui_tab">
	        <div class="weui_navbar">
	            <div class="weui_navbar_item " onclick="to('${urlBasePath }weixin/user/toBizMerchantOpen.do');" style="color: #ffffff;background-color: #04BE02;">
	                	企业商户开户
	            </div>
	            <div class="weui_navbar_item weui_bar_item_on" onclick="to('${urlBasePath }weixin/user/toExpMerchantOpen.do');" >
	               		快递商户开户
	            </div>
	        </div>
			<div class="weui_tab_bd" style="padding-top: 30px;"> 
				<div class="weui_cells weui_cells_form">
					
						<input type="hidden" name="orgNo" value="${orgNo }" />
						<input type="hidden" name="lat" id="lat"  />
						<input type="hidden" name="lng" id="lng"  />
						<div class="weui_cell">
							<div class="weui_cell_hd"><label class="weui_label" style="font-weight: normal;width: 4em;">商户名：</label></div>
							<div class="weui_cell_bd weui_cell_primary">
								<input class="weui_input" type="text" placeholder="请填入商户名"
									maxlength="30"  name="mercName" id="mercName"
									pattern="^\S*$" value="" autocomplete="on" autofocus="autofocus"
									required="required" />
							</div>
						</div>
						<div class="weui_cell">
							<div class="weui_cell_hd"><label class="weui_label" style="font-weight: normal;width: 4em;">联系人：</label></div>
							<div class="weui_cell_bd weui_cell_primary">
								<input class="weui_input" type="text" placeholder="请填入联系人姓名"
									maxlength="5" name="contact" id="contact"
									pattern="^\S*$" value="" autocomplete="on" autofocus="autofocus"
									required="required" />
							</div>
						</div>
						<div class="weui_cell">
							<div class="weui_cell_hd"><label class="weui_label" style="font-weight: normal;width: 4em;">手机号：</label></div>
							<div class="weui_cell_bd weui_cell_primary">
								<input class="weui_input" type="tel" pattern="^[1][3-8]+\d{9}$"
									placeholder="请填写联系人手机号" name="contactPhone" id="contactPhone" 
									value="" maxlength="11"
									required="required" />
							</div>
							<font color="red" id="repeatDiv" style="font-weight: normal;font-size: 14px;"></font>
						</div>
						
						<div class="weui_cell">
							<div class="weui_cell_hd"><label class="weui_label" style="font-weight: normal;width: 4em;">身份证：</label></div>
							<div class="weui_cell_bd weui_cell_primary">
								<input class="weui_input" type="tel" pattern="^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}([0-9]|X)$"
									placeholder="请填入身份证号码" name="certifiNo" id="certifiNo"
									 value="" maxlength="21"
									required="required" />
							</div>
						</div>
						
						<div class="weui_cell">
							<div class="weui_cell_hd"><label class="weui_label" style="font-weight: normal;width: 4em;">邮箱：</label></div>
							<div class="weui_cell_bd weui_cell_primary">
								<input class="weui_input" type="tel" pattern="^[a-z0-9]+([._\\-]*[a-z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$"
									placeholder="请填入邮箱" name="email" id="email" 
									value="" maxlength="50"
									required="required" />
							</div>
						</div>
						
						
						<input type="hidden" value="B" name="mercType"><!-- 设定为企业 -->
						
						
						<div class="weui_cell">
							<div class="weui_cell_hd"><label class="weui_label" style="font-weight: normal;width: 3em;">省份：</label></div>
							<div class="weui_cell_bd weui_cell_primary">
								<select class="weui_select" id="prov" name="payeeProvinceCode"
									onchange="syncCity();" required="required"></select>
							</div>
							<div style="float: right;">
								<a href="javascript:;" onclick="getLocation();"
									class="weui_btn weui_btn_plain_primary weui_btn_mini "> <i
									class="fa fa-map-marker fa-fw"></i>定位
								</a>
							</div>
						</div>
						<div class="weui_cell">
							<div class="weui_cell_hd"><label class="weui_label" style="font-weight: normal;width: 3em;">城市：</label></div>
							<div class="weui_cell_bd weui_cell_primary">
								<select class="weui_select" id="city" name="payeeCityCode"
									required="required"></select>
							</div>
						</div>
						<div class="weui_cell">
							<div class="weui_cell_hd"><label class="weui_label" style="font-weight: normal;width: 5em;">详细地址：</label></div>
							<div class="weui_cell_bd weui_cell_primary">
									<textarea class="weui_textarea" placeholder="请输入详细地址" rows="2" 
									id="address" name="address" pattern="^\S*$"
									maxlength="50"
									></textarea>
							</div>
						</div>
						
						<div class="weui_cell weui_cells_checkbox">
							<div class="weui_cell_hd"><label class="weui_label" style="font-weight: normal;width: 2em;">认证</label></div>
					        <label class="weui_cell weui_check_label clearBorderTop" style="padding: 2px 15px;border-top:;">
					            <div class="weui_cell_hd">
					                <input type="radio" name="companyCerttype" value="" class="weui_check" checked="checked" onchange="syncCert();">
					                <i class="weui_icon_checked"></i>
					            </div>
					            <div class="weui_cell_bd weui_cell_primary">
					                <p style="font-weight: normal;padding-top: 12px;font-size: 10px;" >无</p>
					            </div>
					        </label><br>
					        <label class="weui_cell weui_check_label clearBorderTop" style="padding: 2px 15px;border-top: ;">
					            <div class="weui_cell_hd">
					                <input type="radio" class="weui_check" value="19" name="companyCerttype"  onchange="syncCert();">
					                <i class="weui_icon_checked"></i>
					            </div>
					            <div class="weui_cell_bd weui_cell_primary">
					                <p style="font-weight: normal;padding-top: 12px;font-size: 10px;">营业执照</p>
					            </div>
					        </label>
					        <label class="weui_cell weui_check_label clearBorderTop" style="padding: 2px 15px;border-top:;">
					            <div class="weui_cell_hd">
					                <input type="radio" name="companyCerttype" value="20" class="weui_check"  onchange="syncCert();">
					                <i class="weui_icon_checked"></i>
					            </div>
					            <div class="weui_cell_bd weui_cell_primary">
					                <p style="font-weight: normal;padding-top: 12px;font-size: 10px;" >税务登记证</p>
					            </div>
					        </label>
					    </div>
						
						
						<div class="weui_cell">
							<div class="weui_cell_hd">
								<label class="weui_label" style="font-weight: normal;width:4em;">商家计费</label>
							</div>
							<div class="weui_cell_ft">
									<input class="weui_switch" type="checkbox" id="mercBillSign" name="mercBillSign">
							</div>
						</div>
						
						<div class="weui_cell" style="display: none;" id="companyCertNoDiv">
							<div class="weui_cell_hd"><label class="weui_label" style="font-weight: normal;width:4em;">认证号：</label></div>
							<div class="weui_cell_bd weui_cell_primary">
								<input class="weui_input" type="text"
									placeholder="请填入认证号" id="companyCertNo"
									name="companyCertNo" value="" maxlength="100"/>
							</div>
						</div>
						
						<div class="weui_cell">
							<div class="weui_cell_hd"><label class="weui_label" style="font-weight: normal;width:5em;">代理商户：</label></div>
							<div class="weui_cell_bd weui_cell_primary">
								<input class="weui_input" type="text"
									placeholder="请填入代理商户号" id="agentNo"
									name="agentNo" value="" maxlength="50"/>
							</div>
						</div>
	
						<div class="weui_cell">
							<input class="weui_btn weui_btn_primary" id="showSave"
								type="submit" value="保存" />
						</div>
						
						<div style="display: block;height: 20px;"></div>
						
				</div>
			</div>      
		</div>
	</div>	
	</form>

	<div class="pop">
		<i class="fa fa-home fa-lg popi"></i>
	</div>

	<!-- 引入微信样式代码提示工具开始 -->
	<%@ include file="/pages/wx/wxClass.jsp"%>
	<!-- 引入微信样式代码提示工具结束 -->
	<%@ include file="/pages/wx/baseBottom.jsp"%>

	<script type="text/javascript">
		var provjson = '${provjson}';
		var cityjson = '${cityjson}';
		
		$(function() {
			$("#contactPhone").blur(checkPhone); 
			syncCity();
		})
	</script>



</body>
</html>

